home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / comm / tlxhsl01.zip / HS-D.SLT < prev    next >
Text File  |  1992-03-12  |  6KB  |  115 lines

  1.  
  2. ////////////////////////////////////////////////////////////////////////////////
  3. //       TLXHSL01.SLT                                                         //
  4. //                                                                            //
  5. //              Telix Script to use HS/Link transfer protocol and             //
  6. //       generate a more informative "Log File"...                            //
  7. //                                                                            //
  8. //              This script is designed assuming you have defined             //
  9. //       an environment variable for "DSZLOG" in your AUTOEXEC.BAT            //
  10. //       and that you are using a Telix Usage Log file...                     //
  11. //                                                                            //
  12. //              Consult the "DOCs" for Telix, HS/Link, and DOS if             //
  13. //       you have any questions regarding these variables.                    //
  14. //                                                                            //
  15. //              Written for the "Public Domain" by:  Mr. Jiggs                //
  16. //                                                                            //
  17. //                        Fotobeam/Brookside, Inc.                            //
  18. //                        260 Lexington St.                                   //
  19. //                        Waltham, Ma 02254-4613                              //
  20. //                         Voice: (617) 893-1600                              //
  21. //                           Fax: (617) 893-9951                              //
  22. //                           BBS: (617) 893-6812                              //
  23. //                                                                            //
  24. ////////////////////////////////////////////////////////////////////////////////
  25.  
  26. main () {
  27.          str Switches[255], HS_Use[65], Baud_Rate[10], Port_Num[2];
  28.          int Test_Val;
  29.  
  30.          itos(get_baud(),Baud_Rate);     // Get the Baud Rate, save as Baud_Rate
  31.          itos(get_port(),Port_Num);      // Get the Com Port#, save as Port_Num
  32.  
  33. //       Build the command line extension to the HSLINK command...            //
  34.  
  35.          Switches=" -E";
  36.          strcat(Switches, Baud_Rate);
  37.          strcat(Switches, " -P");
  38.          strcat(Switches, Port_Num);
  39.          strcat(Switches, " ");
  40.          strcat(Switches,_ext_filespec);
  41.  
  42.          if (getenv("DSZLOG", HS_Use)) {      // Check for existence of the   //
  43.              frename(HS_Use, "DSZLOG.ORG");   // DSZLOG Log File (from DOS)   //
  44.              Open_DSZ_Log ();                 // Rename it to "DSZLOG.ORG"    //
  45.           }                                   // and open a new one for this  //
  46.           else                                // transfer...                  //
  47.              prints("No DSZLOG File found !");// Otherwise print this message //
  48.                                               // on the screen...             //
  49.  
  50.          run("HSLINK", Switches, 0);          // Execute the HS/Link Program  //
  51.  
  52.          if (getenv("DSZLOG", HS_Use)) {      // Check that log's still there //
  53.              Transfer_to_Telix_Log();         // then move the information    //
  54.              fdelete(HS_Use);                 // into the Telix Log File and  //
  55.              frename("DSZLOG.ORG", HS_Use);   // delete the new DSZLOG, and   //
  56.             }                                 // finally restore orig DSZLOG  //
  57.  
  58. }
  59.  
  60. Open_DSZ_Log () {
  61.          str Entry_ID[128], Entry_Stripe[128], Stripe[128];
  62.          str Entry_Date[16], Entry_Time[16], DSZ_Log_File[65];
  63.          int Loop, Open_File;
  64.  
  65.          getenv("DSZLOG",DSZ_Log_File);       // Check that log's still there //
  66.  
  67.          date(curtime(),Entry_Date);          // Put the date into Entry_Date //
  68.          time(curtime(),Entry_Time);          // Put the time into Entry_Time //
  69.  
  70.          Stripe = "═";
  71.          for (Loop = 0; Loop < 128; ++Loop)
  72.               strcat(Stripe, "═");
  73.  
  74.          Entry_ID = "HS/Link with ";          //  Create an Entry Divider ID  //
  75.  
  76.          strcat(Entry_ID,_entry_name);        //  with the BBS name           //
  77.          strcat(Entry_ID," (at ");
  78.          strcat(Entry_ID,_entry_num);         //  and Phone Number            //
  79.          strcat(Entry_ID,") begun on ");
  80.          strcat(Entry_ID,Entry_Date);         //  and Date                    //
  81.          strcat(Entry_ID," at ");
  82.          strcat(Entry_ID,Entry_Time);         //  and Time                    //
  83.          substr(Stripe,0,strlen(Entry_ID),Entry_Stripe);
  84.  
  85.          if ( (Open_File = fopen(DSZ_Log_File,"a")) == 0)
  86.                prints("Couldn't open the Log File !");
  87.          else {
  88.                fputc(10,Open_File);           // Write the Divider ID to the  //
  89.                fputs(Entry_ID,Open_File);     // new DSZLOG file...           //
  90.                fputc(10,Open_File);
  91.                fputs(Entry_Stripe,Open_File);
  92.                fputs(Stripe,Open_File);
  93.                fputc(10,Open_File);
  94.                fclose(Open_File);
  95.               }
  96.         }
  97.  
  98. Transfer_to_Telix_Log() {
  99.  
  100.          str HS_Link_File[65], HS_Detail[255];
  101.          int File_Handle;
  102.  
  103.          getenv("DSZLOG",HS_Link_File);
  104.  
  105.          if ( (File_Handle = fopen(HS_Link_File,"r")) != 0) { // If you can  //
  106.                while (!feof(File_Handle)) {               // open the file   //
  107.                        fgets(HS_Detail, 255, File_Handle);// for reading then//
  108.                        ustamp(HS_Detail, 0, 1);           // read until the  //
  109.                        HS_Detail = "";                    // "eof", putting  //
  110.                       }                                   // the info into   //
  111.                fclose(File_Handle);                       // the Telix Log   //
  112.               }
  113.  
  114. }
  115.